﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Alos.Common;
using Alos.Entity;
using Alos.IService;
using System.Threading.Tasks;
using System.Text;
using System.Web;
using Alos.Entity.Dto;


namespace Alos.LanClass.Api
{
    /// <summary>
    ///(点击推送) 课堂检测表
    /// </summary>
    public class ReExamController : ApiController
    {
       IReExamService ReExamService;       
        /// <summary>
        /// 构造函数
        /// </summary>
       /// <param name="_ReExamService"></param>
       public ReExamController(IReExamService _ReExamService)
        {
            ReExamService = _ReExamService;  
        }
       /// <summary>
       /// 检查上一批次课堂测验是否正常结束.创建课堂检测表
       /// </summary>
       /// <param name="ReExam"></param>
       /// <returns>课堂检测1</returns>
       [HttpPost]
       [Route("api/ReExam/GetReExamByLessionID")]
       public JsonRtn<dynamic> GetReExamByLessionID([FromBody]ReExamExtend ReExam)
       {
           var jsRtn = new JsonRtn<dynamic>();
           jsRtn.data = ReExamService.GetReExamByLessionID(Common.Current.User.id, Convert.ToInt32(ReExam.LessionID), Convert.ToInt32(ReExam.ResourceID), Convert.ToDateTime( ReExam.ExamTime));
           return jsRtn;
       }
       /// <summary>
       /// 修改上一批次课堂测验
       /// </summary>
       /// <param name="ReExamID"></param>
       /// <returns>课堂检测</returns>
       [HttpPost]
       [Route("api/ReExam/UpdateReExamByReExamID")]
       public JsonRtn<dynamic> UpdateReExamByReExamID([FromBody]string ReExamID)
       {
           var jsRtn = new JsonRtn<dynamic>();
           jsRtn.data = ReExamService.UpdateReExamByReExamID(ReExamID) ? "True" : ReExamID;
           return jsRtn;
       }
    }
}
